package com.googlecode.continuity.plugin.rating.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.googlecode.continuity.core.client.CoreGWT;
import com.googlecode.continuity.core.client.rpc.RPCCreationCallback;

/**
 * RatingInit
 *
 * @author Peter Schmitt <aragos@aragos.de>
 */
public class RatingInit implements EntryPoint {
  public void onModuleLoad() {
    //register rpc
    CoreGWT.registerRPC("RatingRPCAsync", new RPCCreationCallback() {
      public Object createRPC() {
        RatingRPCAsync ratingRPC = (RatingRPCAsync) GWT.create(RatingRPC.class);
        ServiceDefTarget endpoint = (ServiceDefTarget) ratingRPC;
        String moduleRelativeURL = CoreGWT.getWebappRoot() + "rating.rpc";
        endpoint.setServiceEntryPoint(moduleRelativeURL);
        return ratingRPC;
      }
    });
  }
}
